package com.item.util;

public class BitVector {
	private int bitsperword;
	private int shift;
	private int mask;
	private int N;
	private int[] a;
	
	/**
	 * 1-放入位图中
	 * @param int i
	 * @return
	 */
	public BitVector() {
		bitsperword = 32;
		shift = 5;
		mask = 0x1F;
		N = 10000;
		a = new int[1 + N/bitsperword];
		for(int i = 0; i < a.length; i++) {
			a[i] = 0;
		}
	}
	public void set(int i) {
		a[i>>shift] |= (1 << (i & mask));
	}
	
	public void clear(int i) {
		a[i>>shift] &= ~(1 << (i & mask));
	}
	
	public int test(int i) {
		return a[i >> shift] & (1 << (i & mask));
	}
	
	public int getBitsperword() {
		return bitsperword;
	}
	public void setBitsperword(int bitsperword) {
		this.bitsperword = bitsperword;
	}
	public int getShift() {
		return shift;
	}
	public void setShift(int shift) {
		this.shift = shift;
	}
	public int getMask() {
		return mask;
	}
	public void setMask(int mask) {
		this.mask = mask;
	}
	public int getN() {
		return N;
	}
	public void setN(int n) {
		N = n;
	}
	public int[] getA() {
		return a;
	}
	public void setA(int[] a) {
		this.a = a;
	}
	
//	public static void main(String[] args) {
//		BitVector vector = new BitVector();
//		vector.set(40);
//		System.out.println(vector.getN());
//	}
}
